import React,{Component} from 'react'
import {
    Image,
    TouchableOpacity,
    View,
    Text,
    Dimensions,
    Animated,
    Modal,
} from "react-native";
import JXStorage from "./src/toolManager/JXStorage";

export const {width, height} = Dimensions.get('window');

export default class HomeMaskView extends Component{

    constructor(props) {
        super(props);

        this.state = {
            isVisible:false,
            menuVisible:false,
            active:false,
        }

    }

    render(){
        return (
            <View style={{backgroundColor:'red'}}>
                <Modal animationType={'none'}
                       transparent={true}
                       visible={!this.state.isVisible}>
                    <TouchableOpacity activeOpacity={1} style={{backgroundColor:'rgba(0,0,0,0.7)',position:'absolute',bottom: 0,alignItems:'flex-start',justifyContent:'center',height:height,width:width}}
                                      onPress={()=>{
                                          this.setState({
                                              isVisible:true,
                                          });
                                          JXStorage.storehomeMask(true);
                                      }}>
                        <View style={{flex:1,flexDirection:'row',width:'100%',justifyContent:'space-between',marginTop:185,paddingLeft:30,paddingRight:30}}>
                            <Image style={{width:111,height:94}} source={require('./resource/image/Home/home_card_leftpoint.png')}/>
                            <Image style={{width:118,height:94}} source={require('./resource/image/Home/home_card_rightpoint.png')}/>
                        </View>
                    </TouchableOpacity>
                </Modal>
            </View>
        );
    }

    changeMenuVisible() {

    }

    componentWillMount(): void {

        let that = this;
        JXStorage.gethomeMask(function (cb) {
            console.log("homeMask   "+cb);
            if (cb){
                // that.setState({
                //     isVisible:cb
                // })
            }else{
                that.setState({
                    isVisible:false
                })
            }

        })
    }

    componentWillUnmount() {

    }


}
